/*
 * @Author: c
 * @Date: 2024-01-08 07:21:21
 * @LastEditTime: 2024-03-22 00:58:20
 * @LastEditors: c
 * @Description: 
 * @FilePath: \music-web-backend\src\core\music\artist\dto\search-artist.dto.ts
 * https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Transform } from "class-transformer"
import { IsIn, IsOptional } from "class-validator"
import { PageDto } from "src/common/dto/page.dto"
import { GenderEnum } from "src/common/enums/gender.enum"
import { isNumberString } from "src/common/utils"
import { Artist } from "../entities/artist.entity"

export class SearchArtistDto extends Artist {
    //当前用户是否关注
    isFavorite: string //0,
    //被关注的个数
    favoriteCount: number//471983
    //专辑总数
    albumTotal: number//471983
    //热门单曲总数
    trackTotal: number
    //MV总数
    videoTotal: number
    //头像
    pic: string
    //人物画廊
    pictorialList: string[]
}


export class ArtistPageQuery extends PageDto {
    //关键字(用户名/昵称/手机号)
    // @IsString({message:'查询字段必须是字符串'})
    @IsOptional()
    keywords?: string;
    @IsOptional()
    name: string;
    @IsOptional()
    artistFristLetter?: string;
    @IsOptional()
    artistRegion?: string;
    @IsOptional()
    artistGender?: GenderEnum;

    //用户状态
    // @IsInt({message:'状态类型必须是数字'})
    @Transform((value) => {
        if (isNumberString(value)) {
            return +value
        }

        return value
    })
    @IsIn([0, 1, '', undefined, null], { message: "用户状态参数不正确" })
    status: number;


    //创建时间-开始时间
    // @IsString({message:'开始时间必须是字符串'})
    @IsOptional()
    startTime: string;

    //创建时间-结束时间
    // @IsString({message:'结束时间必须是字符串'})
    @IsOptional()
    endTime: string;
}